﻿

<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>
<%@page import="framework.core.StringUtil"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="framework.core.DBEngine"%>
<%@page import="framework.core.DBResult"%>
<%@page import="com.hitrust.gs.lib.*"%>
<%@ page import="com.hitrust.gs.dao.*"%>

<!--********************* Part2:Java Code *********************-->
<%
	ProductMapOldEvent event = (ProductMapOldEvent)context.getSessionValue("ProductMapOldEvent");
	ObjectList list = ProductMapOld.fetch().search(con,event);
    String isPlanPrice = (String)context.getValue("isPlanprice");
	ObjectList warehouseList = (ObjectList)context.getSessionValue("WarehouseListDetail");
        String status = event.getStatus();
        
        event.setStatus(OutSub.STATUS_AVALIBLE);
        String sql = "select * from ( select sum(Product_Money) from T_OUT_SUB tos,t_product_map_old tpmo,t_out_head toh";
        DBResult dbrs = DBEngine.doSelect(con, sql, event.toConditions());
        ResultSet rs = dbrs.getRs();
        String allMoney = "0";
        if(rs.next()){
            allMoney = rs.getString(1) == null ? "0" : rs.getString(1);    
        }
        dbrs.clear();
        allMoney = StringUtil.showPrice(allMoney);
        
        event.setStatus(status);
    ProductSearchEvent pevent = (ProductSearchEvent)context.getSessionValue("ProductSearchEvent");
    ObjectList plist = Product.fetch().search(con,pevent);  
    pevent.setGrandfatherCategoryCode("");
    ObjectList tManuf1 = ProductCategory.getCategoryLevel1(con);
    ObjectList tManuf2 = ProductCategory.getCategoryLevel2(con);
    ObjectList tManuf3 = ProductCategory.getCategoryLevel3(con);
%>

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->

<%@page import="system.base.OutHeadSrv"%>
<script language=javascript>

var list_code = "listProductMapOld";

function doSearch()
{
    var startHour=document.getElementById("startHour").selectedIndex;
    if(startHour <10){
        startHour=" 0"+startHour+":00:00";
        }else{ 
        startHour=" "+startHour+":00:00";   
        }    
    var endHour=(document.getElementById("endHour").selectedIndex);
    if(endHour <10){
        endHour=" 0"+endHour+":59:59";
        }else{ 
        endHour=" "+endHour+":59:59";  
        }      
	
	var warehouseCodes = $.jstree._reference("#warehouseLevel").get_checked();
    var warehouseList = new Array();
    var i = 0;
     $.each(warehouseCodes, function() {
	           warehouseList[i] =($(this).attr("id"));
	           i++;
		});

    SetValue("WarehouseCodes",warehouseList);
	
    SetValue("s_OutBillCode",GetValue("i_OutBillCode")); //出库单编码

	SetValue("s_RepairBillCode",GetValue("i_RepairBillCode")); //报修单号

	SetValue("s_CustomerBusCode",GetValue("i_CustomerBusCode")); //车号

	SetValue("s_OutType",GetValue("i_OutType")); //出库类型

	SetValue("s_ProductCode",GetValue("i_ProductCode")); //产品编码

	SetValue("s_ProductName",GetValue("i_ProductName")); //产品名称
    
    SetValue("s_KeyWord",GetValue("i_KeyWord")); //产品关键字

	SetValue("s_CustomerName",GetValue("i_CustomerName")); //客户

	SetValue("s_GetCustomerName",GetValue("i_GetCustomerName")); //领料单位

    SetValue("s_BalanceMode",GetValue("i_BalanceMode")); //结算模式

	SetValue("s_StartOutTime",GetValue("i_StartOutTime")==""?"":GetValue("i_StartOutTime")+startHour); //出库开始日期
    
    SetValue("s_EndOutTime",GetValue("i_EndOutTime")==""?"":GetValue("i_EndOutTime")+endHour); //出库结束日期
    
    SetValue("s_IsNormal",GetValue("i_IsNormal")); //是否正式产品

    SetValue("s_KeeperStaffId",GetValue("i_KeeperStaffId")); //管理员id
    SetValue("s_PositionCode",GetValue("i_PositionCode")); //货位CODE
    SetValue("s_Status", GetValue("i_Status"));

	SetValue("s_OrderField",GetValue("i_OrderField")); //排序
	SetValue("s_OrderDesc",getCheckBoxValues("i_OrderDesc")); //升降序
    SetValue("s_GrandfatherCategoryCode",GetValue("i_GrandfatherCategoryCode")); //产品分类编码
    SetValue("s_UpperCategoryCode",GetValue("i_UpperCategoryCode")); //产品分类编码
    SetValue("s_CategoryCode",GetValue("i_CategoryCode")); //产品分类编码  
    SetValue("s_ProviderName",GetValue("i_ProviderName")); //供应商名称  
    SetValue("s_UpperType",GetValue("i_upperType")); //产品区域分类编码 
    SetValue("s_ProductType",GetValue("i_productType")); //产品招标分类编码 
	doCommonSearch();
}

function bizViewOutHead(id)
{
	viewWin("<%=Config.getSrv()%>?action_code=viewOutHead&Id="+id);
}

function insertOrUpdate(){
	window.open("<%= response.encodeURL(request.getContextPath() + "//A3000051.do")%>");
}


function downloadMould(){
	frm.action = "<%=response.encodeURL(request.getContextPath()+"//A3000052.do")%>";
	frm.submit();
}

function doExport()
{
	<%if(list.getTotalSize()>15000){%>
	alert('导出的数据过大，请缩小查询范围！');
	return;
	<%}%>
    SetAction("exportProductMapOld");
    frm.submit();
}


function selectOnChange1()
{
  var val = GetValue("i_GrandfatherCategoryCode");
  if(val==''){
    var listbox = document.getElementById("i_UpperCategoryCode");
    listbox.length = 0;
    var option = new Option();
    option.text = "---二级---";
    option.value = "";
    listbox.options[listbox.length] = option;
    //change2(optval);
  }else{
      var counter="0";
      <%if(tManuf1.size()>0)
      {
          for(int i=0;i<tManuf1.size();i++)
          {
              ProductCategory pc1 = (ProductCategory)tManuf1.get(i);
              String tCode1 = pc1.getCode();
              %>
              if(val == '<%=tCode1%>')
              {
                counter="1";
                var listbox = document.getElementById("i_UpperCategoryCode");
                listbox.length = 0;
                var option1 = new Option();
                option1.text = "---二级---";
                option1.value = "";
                listbox.options[listbox.length] = option1;
                <%
                for(int n=0;n<tManuf2.size();n++)
                {
                    ProductCategory pc2 = (ProductCategory)tManuf2.get(n);
                    String tUpperCategory = pc2.getUpperCategory();
                    if(tUpperCategory == null) tUpperCategory = "";
                    if(tUpperCategory.equals(tCode1))
                    {
                        String categoryId = pc2.getCode();
                        String categoryName = pc2.getName();
                        %>
                        var temp1 = '<%=categoryId%>';
                        var temp2 = '<%=categoryName%>';
                        var option1 = new Option();
                        option1.value = temp1;
                        option1.text = temp2;
                        listbox.options[listbox.length] = option1;                       
                        <%
                    }
                }//end for
                %>
         
               }//end if
          <%
            }//end for
        }//end if
      %>
      
      if(counter == '0')
      {
          var listbox = document.getElementById("i_UpperCategoryCode");
          listbox.length = 0;
          var option = new Option();
          option.value = "";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;  
       }

   }//end else

}


function selectOnChange2()
{
  var val = GetValue("i_UpperCategoryCode");
  if(val==''){
    var listbox = document.getElementById("i_CategoryCode");
    listbox.length = 0;
    var option = new Option();
    option.text = "---三级---";
    option.value = "";
    listbox.options[listbox.length] = option;
    //change2(optval);
  }else{
      var counter="0";
      <%if(tManuf1.size()>0)
      {
          for(int i=0;i<tManuf2.size();i++)
          {
              ProductCategory pc2 = (ProductCategory)tManuf2.get(i);
              String tCode2 = pc2.getCode();
              %>
              if(val == '<%=tCode2%>')
              {
                counter="1";
                var listbox = document.getElementById("i_CategoryCode");
                listbox.length = 0;
                var option1 = new Option();
                option1.text = "---三级---";
                option1.value = "";
                listbox.options[listbox.length] = option1;
                <%
                for(int n=0;n<tManuf3.size();n++)
                {
                    ProductCategory pc3 = (ProductCategory)tManuf3.get(n);
                    String tUpperCategory = pc3.getUpperCategory();
                    if(tUpperCategory == null) tUpperCategory = "";
                    if(tUpperCategory.equals(tCode2))
                    {
                        String categoryId = pc3.getCode();
                        String categoryName = pc3.getName();
                        %>
                        var temp1 = '<%=categoryId%>';
                        var temp2 = '<%=categoryName%>';
                        var option1 = new Option();
                        option1.value = temp1;
                        option1.text = temp2;
                        listbox.options[listbox.length] = option1;                       
                        <%
                    }
                }//end for
                %>
         
               }//end if
          <%
            }//end for
        }//end if
      %>
      
      if(counter == '0')
      {
          var listbox = document.getElementById("i_CategoryCode");
          listbox.length = 0;
          var option = new Option();
          option.value = "";
          option.text = "---三级---";
          listbox.options[listbox.length] = option;  
       }

   }//end else

}

key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>
<script type="text/javascript" src = "<%=Config.getWebPath()%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src = "<%=Config.getWebPath()%>/js/jquery.jstree.js"></script>
<link type="text/css" rel="stylesheet" href="<%=Config.getWebPath()%>/css/themes/default/style.css"/>
<script type="text/javascript">
	   $(function() {
		    $("#warehouseLevel").jstree({
		        "plugins" : [ "themes", "html_data", "checkbox", "ui" ]
		       
		    });
		    
		    var checkedWarehouseCodes = "<%=event.getWarehouseTreeCode()[0]%>";
		    
		    if(checkedWarehouseCodes == "") checkedWarehouseCodes = "00";
		    
		    var arrayCheckedWarehouseCodes = checkedWarehouseCodes.split(",");
		   
		   		  	
		  	var checkSel = function(ary, val) {
		  		for(var i=0; i<ary.length; i++) {
		  			if(ary[i] == val) {
		  				return true;
		  			}
		  		}
		  		
		  		return false;
		  	}
		    <%if(context.getString("isFirstVisit").equals("false")){ %>
			  	$("#warehouseLevel li").each(
			  		function() 	{
			  			if(checkSel(arrayCheckedWarehouseCodes, $(this).attr("id"))) {
			  				$.jstree._reference("#warehouseLevel").check_node($(this));
			  			} 	  			
			  		}
			  	);
		  	<%}%>
		  
		});
		
</script>

<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>
<%double countOutMoney = 0; %>
<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">

<!--查询条件保留区域-->
<%
System.out.println("Form start");
%>
<input type=hidden name="WarehouseCodes" value="<%=event.getWarehouseTreeCode()[0]%>" > 

<input type=hidden name="s_OutBillCode" value="<%=event.getOutBillCode()%>"> <!--出库单编码-->

<input type=hidden name="s_RepairBillCode" value="<%=event.getRepairBillCode()%>"> <!--报修单号-->

<input type=hidden name="s_CustomerBusCode" value="<%=event.getCustomerBusCode()%>"> <!--车号-->

<input type=hidden name="s_OutType" value="<%=event.getOutType()%>"> <!--出库类型-->

<input type=hidden name="s_BalanceFlag" value="<%=event.getBalanceFlag()%>"> <!--结算状态-->

<input type=hidden name="s_ProductCode" value="<%=event.getProductCode()%>"> <!--产品编码-->

<input type=hidden name="s_ProductName" value="<%=event.getProductName()%>"> <!--产品名称-->

<input type=hidden name="s_KeyWord" value="<%=event.getKeyWord()%>"> <!--产品关键字-->

<input type=hidden name="s_CustomerName" value="<%=event.getCustomerName()%>"> <!--客户名称-->

<input type=hidden name="s_GetCustomerName" value="<%=event.getGetCustomerName()%>"> <!--领料单位-->

<input type=hidden name="s_BalanceMode" value="<%=event.getBalanceMode()%>"> <!--结算模式-->

<input type=hidden name="s_StartOutTime" value="<%=event.getStartOutTime()%>"> <!--出库开始日期-->

<input type=hidden name="s_EndOutTime" value="<%=event.getEndOutTime()%>"> <!--出库结束日期-->

<input type=hidden name="s_IsNormal" value="<%=event.getIsNormal()%>"> <!--是否正式产品-->

<input type=hidden name=s_KeeperStaffId value="<%=event.getKeeperStaffId()%>"> <!--选择的管理员id-->
<input type=hidden name=s_PositionCode value="<%=event.getPositionCode()%>"> <!--选择的货位code-->

<input type=hidden name="s_Status" value="<%=event.getStatus()%>"> <!--单据状态-->
<input type=hidden name="s_CategoryCode" value="<%=event.getCategoryCode()%>">
<input type=hidden name="s_UpperCategoryCode" value="<%=event.getUpperCategoryCode()%>">
<input type=hidden name="s_GrandfatherCategoryCode" value="<%=event.getGrandfatherCategoryCode()%>">
<input type=hidden name="s_ProviderName" value="<%=event.getProviderName()%>">
<input type=hidden name="s_UpperType" value="<%=event.getUpperType()%>">
<input type=hidden name="s_ProductType" value="<%=event.getProductType()%>">
<%
System.out.println("Form end");
%>
<%@ include file="/framework/list_head.jsp"%>

<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
	int key_tab = 1 ;
%>
<%
System.out.println("search area start");
%>

	<%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
              仓库选择：
            <div id="warehouseLevel" style="background-color: DEE4E9">
				<%=Warehouse.getWarehouseTree(warehouseList,event.getWarehouseCodes())%>
			</div>
        </td>       
    </tr>
    <%=uiSearchInputTR%>>
    <%=uiSearchInputTDHead%>>
            产品分类：&nbsp;&nbsp;
            <%=SelectManager.viewGrandFatherSelect(con,"i_GrandfatherCategoryCode",pevent.viewGrandfatherCategoryCode(),true,"","--一级--","","onchange='selectOnChange1()' key_tab="+(key_tab++))%>
            <%=SelectManager.viewUpperSelect(con,"i_UpperCategoryCode",pevent.viewUpperCategoryCode(),true,"","--二级--","","onchange='selectOnChange2()' key_tab="+(key_tab++))%>
            <%=SelectManager.viewUpperSelect(con,"i_CategoryCode",pevent.viewCategoryCode(),true,"","--三级--","","key_tab="+(key_tab++))%>
         &nbsp;供应商名称：<input type="text" class="texts" name="i_ProviderName" size="20" value="<%=event.viewProviderName()%>" key_tab="<%=key_tab++%>">
         
         </td>       
    </tr>
	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
			出库单编码：
			<input type="text" class="texts" name="i_OutBillCode" size="20" value="<%=event.viewOutBillCode()%>" key_tab="<%=key_tab++%>">
            &nbsp;&nbsp;&nbsp;&nbsp;报修单号：
            <input type="text" class="texts" name="i_RepairBillCode" size="20" value="<%=event.viewRepairBillCode()%>" key_tab="<%=key_tab++%>">
            &nbsp;&nbsp;&nbsp;&nbsp;车号：
            <input type="text" class="texts" name="i_CustomerBusCode" size="20" value="<%=event.viewCustomerBusCode()%>" key_tab="<%=key_tab++%>">
        </td>       
    </tr>

    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
              出库类型：&nbsp;&nbsp;
            <%=SelectManager.viewOutTypeSelect(con,"i_OutType",event.viewOutType(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>  
            &nbsp;&nbsp;&nbsp;&nbsp;保管员：&nbsp;&nbsp;
            <%=SelectManager.viewWarehouseStaffSelect(con,loginInfo.getLoginWarehouseCode(),"i_KeeperStaffId",event.getKeeperStaffId(),false,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++),event.getWarehouseCodes())%>
        </td>       
    </tr>
    
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
              产品编码：&nbsp;&nbsp;
            <input type="text" class="texts" name="i_ProductCode" size="20" value="<%=event.getProductCode()%>" key_tab="<%=key_tab++%>">
            &nbsp;&nbsp;&nbsp;&nbsp;产品名称：
            <input type="text" class="texts" name="i_ProductName" size="20" value="<%=event.getProductName()%>" key_tab="<%=key_tab++%>">
            &nbsp;&nbsp;&nbsp;&nbsp;单据状态：
            <%=SelectManager.viewValidOrNoSelect("i_Status",event.viewStatus(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>       
    </tr>
    
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
              产品关键字：
            <input type="text" class="texts" name="i_KeyWord" size="20" value="<%=event.viewKeyWord()%>" key_tab="<%=key_tab++%>">
            <% out.print("(对产品编码、名称、型号、规格、品牌、生产厂商、附加属性等七个关键字的模糊查询）");%>
        </td>       
    </tr>

    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
              客户：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="text" class="texts" name="i_CustomerName" size="20" value="<%=event.viewCustomerName()%>" key_tab="<%=key_tab++%>">
			&nbsp;&nbsp;&nbsp;&nbsp;领料单位：
			<input type="text" class="texts" name="i_GetCustomerName" size="20" value="<%=event.getGetCustomerName()%>" key_tab="<%=key_tab++%>">
		    &nbsp;&nbsp;&nbsp;&nbsp;结算模式：
            <%=SelectManager.viewYKorMD("i_BalanceMode",event.getBalanceMode(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>		
	</tr>
    
	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
			出库时间：&nbsp;&nbsp;
            <%=framework.custom.UIManager.generateDateInput("i_StartOutTime",event.getStartOutTime().equals("")?"":event.getStartOutTime().substring(0,10))%>
              <select id="startHour" >
              <%for(int i=0;i<24;i++){ %>
                <option><%=i %></option>
                <%} %>
              </select>
    
                至
             <%=framework.custom.UIManager.generateDateInput("i_EndOutTime", event.getEndOutTime().equals("")?"":event.getEndOutTime().substring(0,10))%>
              <select id="endHour">
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
                <option>11</option>
                <option>12</option>
                <option>13</option>
                <option>14</option>
                <option>15</option>
                <option>16</option>
                <option>17</option>
                <option>18</option>
                <option>19</option>
                <option>20</option>
                <option>21</option>
                <option>22</option>
                <option>23</option>
                <option selected="selected">24</option>
              </select> 
		    &nbsp;&nbsp;&nbsp;&nbsp;是否正式产品：
            <%=SelectManager.viewYesOrNoSelect("i_IsNormal",event.getIsNormal(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>		
	</tr>
       	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
		           区域分类：&nbsp;&nbsp;
                    	<select name="i_upperType" >
                    		<%
                    			String upperType = (String)(event.getUpperType()==null?"":event.getUpperType()); 
                    			GSProductTypeManagerDao productTypeManagerDao= new GSProductTypeManagerDao();
                    			Conditions managerConditions = new Conditions();
                    			managerConditions.add(" upper_type = 1000");
                    			managerConditions.add(" status='1' order by product_type");
                  		        DBConnection con1 = null;
                    			ObjectList productTypeManagerTypeList = ObjectList.getList();
                    			try{
                    				con1 = DBConnection.open();
                    				productTypeManagerTypeList = ProductTypeManager.fetch().search(con,managerConditions);
                    			}finally{
                    				if(con1!=null){
                    					con1.close();
                    				}
                    			}	 
                    		 
                    		 if(upperType==null){
                    	%>
                    		<option value="">---全部---</option>
                    				<%							for(int i=0;i<productTypeManagerTypeList.size();i++){
									ProductTypeManager productTypeManager = (ProductTypeManager)productTypeManagerTypeList.get(i);
								 %>
										<option value="<%=productTypeManager.getProductType() %>" ><%=productTypeManager.getTypeName() %></option>
								<%
									}
								 %>
                    		<%}else{ %>
                    		 <option value="">---全部---</option>
<%							for(int i=0;i<productTypeManagerTypeList.size();i++){
									ProductTypeManager productTypeManager = (ProductTypeManager)productTypeManagerTypeList.get(i);
								 %>
										<option value="<%=productTypeManager.getProductType() %>"  <%if(productTypeManager.getProductType().equals(String.valueOf(upperType))) {%> selected="selected"<%} %> ><%=productTypeManager.getTypeName() %></option>
								<%
									}
								 %>
                    		<%} %>
                    	
                    	</select>

                
                    &nbsp;&nbsp;分类：&nbsp;&nbsp;
                    	<select name="i_productType">
                    	<%
                    	String productType = (String)(event.getProductType()==null?"":event.getProductType()); 
            			GSProductTypeManagerDao proTypeManagerDao1= new GSProductTypeManagerDao();
            			Conditions conditions = new Conditions();
            			conditions.add(" upper_type = 2000");
            			conditions.add(" status='1' order by product_type ");
          		        DBConnection con2 = null;
            			ObjectList  bidTypeList = ObjectList.getList();
            			try{
            				con2 = DBConnection.open();
            				bidTypeList = ProductTypeManager.fetch().search(con,conditions);
            			}finally{
            				if(con2!=null){
            					con2.close();
            				}
            			}	 
            		
            			 if(productType==null){
                         	%>
                         		<option value="">---全部---</option>
                         				<%						for(int i=0;i<bidTypeList.size();i++){
     									ProductTypeManager productTypeManager = (ProductTypeManager)bidTypeList.get(i);
     								 %>
     										<option value="<%=productTypeManager.getProductType() %>" ><%=productTypeManager.getTypeName() %></option>
     								<%
     									}
     								 %>
                         		<%}else{ %>
                         		 <option value="">---全部---</option>
     <%							for(int i=0;i<bidTypeList.size();i++){
     									ProductTypeManager productTypeManager = (ProductTypeManager)bidTypeList.get(i);
     								 %>
     										<option value="<%=productTypeManager.getProductType() %>"  <%if(productTypeManager.getProductType().equals(String.valueOf(productType))) {%> selected="selected"<%} %> ><%=productTypeManager.getTypeName() %></option>
     								<%
     									}
     								 %>
                         		<%} %>
                         	
                         	</select>
		
			</td>
	</tr>

	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
			按排序：&nbsp;&nbsp;&nbsp;&nbsp;
            	
			<select name="i_OrderField">
				<option value="" <%=(event.getOrderField().equals("1"))?"selected":""%>>设置排序字段</option>
				
				<option value="OUT_BILL_CODE" <%=(event.getOrderField().equals("OUT_BILL_CODE"))?"selected":""%>>出库单编码</option>
				
				<option value="CREATE_TIME" <%=(event.getOrderField().equals("CREATE_TIME"))?"selected":""%>>出库日期</option>
				
			</select>
               仓库货位：
            <%=SelectManager.viewWarehousePosition(con,loginInfo.getLoginWarehouseCode(),"i_PositionCode",event.getPositionCode(),false,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++),event.getWarehouseCodes())%>
            
			&nbsp;&nbsp;
			<input type="radio" name="i_OrderDesc" value="false" <%=(event.isOrderDesc()==false)?"checked":""%> >升序
			<input type="radio" name="i_OrderDesc" value="true"  <%=(event.isOrderDesc()==true)?"checked":""%>  >降序
			<input type="button" value="查询" class="buttons" onclick="doSearch();return false;">&nbsp;<input type="button" value="清空" class="buttons" onclick="doClearEvent();return false;">
		</td>
	</tr>

<%=uiSearchEnd%>

<!--列表标题-->
<%=UIManager.addListHeadTitle("老库存异常查询")%>

<!--********************* Part6:List Area ***************-->
<%
System.out.println("List area start");
%>
<%=uiListStart%>>

<%@ include file="/framework/list_foot.jsp"%>

<%
	int index = 1 ;
%>	
	<%=uiListHeadTR%>>

        <%=UIManager.addListHead("仓库",index++)%>
        
        <%=UIManager.addListHead("货位",index++)%>
        
		<%=UIManager.addListHead("出库单编码",index++)%>

        <%=UIManager.addListHead("出库日期",index++)%>

        <%=UIManager.addListHead("客户",index++)%>

        <%=UIManager.addListHead("出库类型",index++)%>
        
        <%=UIManager.addListHead("供应商",index++)%>

        <%=UIManager.addListHead("报修单",index++)%>

        <%=UIManager.addListHead("车号",index++)%>
        
        <%=UIManager.addListHead("产品编码",index++)%>

        <%=UIManager.addListHead("产品名称",index++)%>

        <%=UIManager.addListHead("单位",index++)%>

        <%=UIManager.addListHead("规格",index++)%>

        <%=UIManager.addListHead("型号",index++)%>

        <%=UIManager.addListHead("品牌",index++)%>

        <%=UIManager.addListHead("数量",index++)%>
        <%if(isPlanPrice.equals("1")){ //湖南巴士显示价格金额%>
                       
        <%=UIManager.addListHead("计划价",index++)%>
        
        <%=UIManager.addListHead("计划金额",index++)%>
        
        <%=UIManager.addListHead("实际价",index++)%>
       
        <%=UIManager.addListHead("实际金额",index++)%>
         
        <%}else{  //上海巴士显示价格金额%>
            
            <%=UIManager.addListHead("单价",index++)%>
        
            <%=UIManager.addListHead("金额",index++)%>
         
        <% } %>
		<%=UIManager.addListHead("领料单位",index++)%>
        
		<%=UIManager.addListHead("领料人",index++)%>

		<%=UIManager.addListHead("结算模式",index++)%>

        <%=UIManager.addListHead("保管员",index++)%>
        <%=UIManager.addListHead("老库存编码",index++)%>
		<%=UIManager.addListHead("操作",-1)%>  
	<%=uiListHeadTREnd%>>
	
	<!--data-->
<%
System.out.println("list.size()="+list.size());
	for(int i=0;i<list.size();i++)
	{
	    //System.out.println("list.size()"+list.size());
		ProductMapOld obj = (ProductMapOld)list.get(i);
		OutHead head = OutHead.fetchByOutBillId(con,obj.getOutBillId());
        Product pro = Product.fetchByConcentricityCode(con,obj.getProductCode());
        if (pro == null) pro = new Product();
        if (obj!=null && head!=null && pro!=null) {
%>
	<%=uiListDataTR[i%2]%> align=center>
    
        <%=uiListDataTD%>><%=head.viewWarehouseName(con)%></td>
        
        <%=uiListDataTD%>><%=obj.viewPositionName(con)%></td>
    
    	<%=uiListDataTD%>><%=head.viewOutBillCode(con)%></td>
    
        <%=uiListDataTD%>><%=head.viewOutTime(con)%></td>
    
        <%=uiListDataTD%>><%=head.viewCustomerName(con)%></td>
    
        <%=uiListDataTD%>><%=head.viewOutType(con)%></td>
        
        <%=uiListDataTD%>><%=obj.viewProviderName(con)%></td>
    
    	<%=uiListDataTD%>><%=head.viewRepairBillCode(con)%></td>
    
    	<%=uiListDataTD%>><%=obj.viewCustomerBusCode(con)%></td>
        
        <%=uiListDataTD%>><%=obj.viewProductCode(con)%></td>
    
        <%=uiListDataTD%>><%=pro.viewName(con)%></td>
    
        <%=uiListDataTD%>><%=pro.viewProductUnit(con)%></td>
    
        <%=uiListDataTD%>><%=pro.viewSpec(con)%></td>
    
        <%=uiListDataTD%>><%=pro.viewModel(con)%></td>
    
        <%=uiListDataTD%>><%=pro.viewProductBrand(con)%></td>
        
        <%=uiListDataTD%>><%=StringUtil.showCount(obj.viewProductCount(con))%></td>
        
        <%if(isPlanPrice.equals("1")){ //湖南巴士显示价格金额%>
        <%=uiListDataTD%>><%=StringUtil.showPrice(obj.viewProductPrice(con))%></td>
        <%=uiListDataTD%>><%=StringUtil.showPrice(obj.viewProductMoney(con))%></td>
        <%=uiListDataTD%>><%=StringUtil.showPrice(obj.viewActualPrice(con))%></td>
        <%
        String price = StringUtil.showPrice(String.valueOf(obj.getActualPrice()*obj.getProductCount()));
        %>
        <%=uiListDataTD%>><%=price%></td>
        
        <%}else{ //上海巴士显示价格金额%>
            <%=uiListDataTD%>><%=StringUtil.showPrice(obj.viewProductPrice(con))%></td>
            <%=uiListDataTD%>><%=StringUtil.showPrice(obj.viewProductMoney(con))%></td>
        <% } %>
        
        <%countOutMoney = countOutMoney + Double.parseDouble(obj.viewProductMoney(con)); %>
        <%=uiListDataTD%>><%=obj.viewGetCustomerName(con)%></td>
    
        <%=uiListDataTD%>><%=obj.viewGetCustomerStaffName(con)%></td>
    
        <%=uiListDataTD%>><%=obj.viewBalanceMode(con)%></td>
    	
        <%        
        WarehouseStaff ws = ProductMapOldSrv.getWarehouseStaff(obj,head,con);%>
        <%=uiListDataTD%>><% if(ws != null){ %><%=ws.getName()%><% } %></td>
        <%=uiListDataTD%>><%=obj.viewProductCodeMap(con)%></td>
    	<%=uiListDataTD%>>
    		<a href="" onclick="bizViewOutHead('<%=obj.getOutBillId()%>');return false;">详细</a>
    	</td>
  	</tr>
<%	
        }
	}
%>  
<%if(isPlanPrice.equals("1")){%>
<%=uiListDataTR[0]%> align=center>    
<%=uiListDataTD%> colspan='26' align = right >
            <b><%="当前页出库货物金额合计:"+StringUtil.showPrice(String.valueOf(countOutMoney))%></b>
    </td>
</tr>
<%=uiListDataTR[0]%> align=center>
<%=uiListDataTD%> colspan='26' align = right >
            <b><%="当前查询有效出库单金额合计:"+allMoney%></b>
    </td>
</tr>
<%}else{%>
<%=uiListDataTR[0]%> align=center>    
<%=uiListDataTD%> colspan='24' align = right >
            <b><%="当前页出库货物金额合计:"+StringUtil.showPrice(String.valueOf(countOutMoney))%></b>
    </td>
</tr>
<%=uiListDataTR[0]%> align=center>
<%=uiListDataTD%> colspan='24' align = right >
            <b><%="当前查询有效出库单金额合计:"+allMoney%></b>
    </td>
</tr>
<%}%>
<%@ include file="/framework/list_foot2.jsp"%>

<%=uiListEnd%>


<!--********************* Part7:Action Area ***************-->
<%=uiCommandStart%>>
	<%=uiCommandTR%>>
		<%=uiCommandTD%>>
		<input type=button value="批量导入" class="buttons" onclick="insertOrUpdate();return false;">
        <input type=button value="   导出   " class="buttons" onclick="doExport();return false;">
        <input type=button value="下载导入模板 " class="buttons" onclick="downloadMould();return false;"> 
        </td>
	</tr>	
<%=uiCommandEnd%>
</form>


<%@ include file="/framework/foot.jsp"%>

<!--
	Author    :Wing
	FileName  :/system/base/OutHeadList.jsp
-->
